import React from 'react';

const ImageIconTag = ({ type, size }) => {
    const cleanType = type.replace(/\d+$/, '');
    const imageUrl = `assets/${cleanType}Icon.svg`;

    const handleImageError = (event) => {
        event.target.src = `assets/UserInputNodeIcon.svg`;
    };

    return (
        <img
            data-type={cleanType}
            className={size === "l" ? "headerLargeIcon" : "listImageStyle"}
            src={imageUrl}
            onError={handleImageError}
            alt=""
        />
    );
};

export default ImageIconTag;
